﻿<%@ Page Language="C#" AutoEventWireup="true" CodeFile="office_acl.aspx.cs" Inherits="office_acl" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
    <title>无标题页</title>
</head>
<body>
    <form id="form1" runat="server">
    <div>
        改用存储过程：core_update_office_acl 实现，此处仅浏览！<br />
        <br />
        <asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="False" DataKeyNames="office_type,func_id"
            DataSourceID="SqlDataSource1">
            <Columns>
                <asp:CommandField ShowDeleteButton="True" />
                <asp:BoundField DataField="office_type" HeaderText="office_type" ReadOnly="True"
                    SortExpression="office_type" />
                <asp:BoundField DataField="func_id" HeaderText="func_id" ReadOnly="True" SortExpression="func_id" />
            </Columns>
        </asp:GridView>
        <asp:SqlDataSource ID="SqlDataSource1" runat="server" ConnectionString="<%$ ConnectionStrings:SparrowDB %>"
            DeleteCommand="DELETE FROM [office_acl] WHERE [office_type] = @office_type AND [func_id] = @func_id"
            InsertCommand="INSERT INTO [office_acl] ([office_type], [func_id]) VALUES (@office_type, @func_id)"
            SelectCommand="SELECT * FROM [office_acl]">
            <DeleteParameters>
                <asp:Parameter Name="office_type" Type="String" />
                <asp:Parameter Name="func_id" Type="String" />
            </DeleteParameters>
            <InsertParameters>
                <asp:Parameter Name="office_type" Type="String" />
                <asp:Parameter Name="func_id" Type="String" />
            </InsertParameters>
        </asp:SqlDataSource>
        <asp:FormView ID="FormView1" runat="server" DataKeyNames="office_type,func_id" DataSourceID="SqlDataSource1"
            DefaultMode="Insert">
            <EditItemTemplate>
                office_type:
                <asp:Label ID="office_typeLabel1" runat="server" Text='<%# Eval("office_type") %>'>
                </asp:Label><br />
                func_id:
                <asp:Label ID="func_idLabel1" runat="server" Text='<%# Eval("func_id") %>'></asp:Label><br />
                <asp:LinkButton ID="UpdateButton" runat="server" CausesValidation="True" CommandName="Update"
                    Text="更新">
                </asp:LinkButton>
                <asp:LinkButton ID="UpdateCancelButton" runat="server" CausesValidation="False" CommandName="Cancel"
                    Text="取消">
                </asp:LinkButton>
            </EditItemTemplate>
            <InsertItemTemplate>
                office_type:
                <asp:TextBox ID="office_typeTextBox" runat="server" Text='<%# Bind("office_type") %>'>
                </asp:TextBox><br />
                func_id:
                <asp:TextBox ID="func_idTextBox" runat="server" Text='<%# Bind("func_id") %>'>
                </asp:TextBox><br />
                <asp:LinkButton ID="InsertButton" runat="server" CausesValidation="True" CommandName="Insert"
                    Text="插入">
                </asp:LinkButton>
                <asp:LinkButton ID="InsertCancelButton" runat="server" CausesValidation="False" CommandName="Cancel"
                    Text="取消">
                </asp:LinkButton>
            </InsertItemTemplate>
            <ItemTemplate>
                office_type:
                <asp:Label ID="office_typeLabel" runat="server" Text='<%# Eval("office_type") %>'>
                </asp:Label><br />
                func_id:
                <asp:Label ID="func_idLabel" runat="server" Text='<%# Eval("func_id") %>'></asp:Label><br />
                <asp:LinkButton ID="DeleteButton" runat="server" CausesValidation="False" CommandName="Delete"
                    Text="删除">
                </asp:LinkButton>
                <asp:LinkButton ID="NewButton" runat="server" CausesValidation="False" CommandName="New"
                    Text="新建">
                </asp:LinkButton>
            </ItemTemplate>
        </asp:FormView>
        <asp:GridView ID="GridView2" runat="server" AutoGenerateColumns="False" DataKeyNames="func_id"
            DataSourceID="SqlDataSource2">
            <Columns>
                <asp:BoundField DataField="func_id" HeaderText="func_id" ReadOnly="True" SortExpression="func_id" />
                <asp:BoundField DataField="rank" HeaderText="rank" SortExpression="rank" />
                <asp:BoundField DataField="name" HeaderText="name" SortExpression="name" />
            </Columns>
        </asp:GridView>
        <asp:SqlDataSource ID="SqlDataSource2" runat="server" ConnectionString="<%$ ConnectionStrings:SparrowDB %>"
            DeleteCommand="DELETE FROM [functions] WHERE [func_id] = @func_id" InsertCommand="INSERT INTO [functions] ([func_id], [rank], [name]) VALUES (@func_id, @rank, @name)"
            SelectCommand="SELECT * FROM [functions]" UpdateCommand="UPDATE [functions] SET [rank] = @rank, [name] = @name WHERE [func_id] = @func_id">
            <DeleteParameters>
                <asp:Parameter Name="func_id" Type="String" />
            </DeleteParameters>
            <UpdateParameters>
                <asp:Parameter Name="rank" Type="Byte" />
                <asp:Parameter Name="name" Type="String" />
                <asp:Parameter Name="func_id" Type="String" />
            </UpdateParameters>
            <InsertParameters>
                <asp:Parameter Name="func_id" Type="String" />
                <asp:Parameter Name="rank" Type="Byte" />
                <asp:Parameter Name="name" Type="String" />
            </InsertParameters>
        </asp:SqlDataSource>
    
    </div>
    </form>
</body>
</html>
